<include file="public/header"/>
<style>
	.cash_num p {
		 padding-bottom: 0px;
	}
	.tab_hd{border-top: 1px solid #eee;background:#fff;border-bottom: 1px solid #eee;}
	.tab_hd ul{display: flex;}
	.tab_hd ul li{flex:1;text-align: center;}
	.tab_hd ul li a{margin:0 auto;display: inline-block;height: 40px;font-size:14px;}
	.tab_hd ul li a.on{border-bottom:2px solid #ec3913;color:#ec3913;}
	::-webkit-input-placeholder{color: #cec6c6;opacity:1;}
</style>
<body>
<header>
  <div class="tab_nav">
    <div class="header">
      <div class="h-left"><a class="sb-back" href="javascript:history.back(-1)" title="返回"></a></div>
      <div class="h-mid">在线提现</div>
      <div class="h-right">
        <aside class="top_bar">
          <div onClick="show_menu();$('#close_btn').addClass('hid');" id="show_more"><a href="javascript:;"></a> </div>
        </aside>
      </div>
    </div>
  </div>
</header>
<include file="public/menu"/>
<div id="tbh5v0">
    <div class="Personal">
        <div id="tbh5v0">

<div class="tab_hd">
      <ul>
        <li><a href="javascript:void(0)" onclick="tabindex(1)" class="tab_head1 on">提现到微信</a></li>
        <li><a href="javascript:void(0)" onclick="tabindex(2)" class="tab_head2">提现到银行卡</a></li>
      </ul>
  </div>
  <div class="innercontent1">
      <form action="" method="post" enctype="multipart/form-data" name="distribut_form" id="distribut_form">
          <div class="name"><span>昵　 称</span>
              <input type="text" name="nickname" id="nickname" value="{$user.nickname|shownickname=###}" class="c-f-text" disabled="true">
          </div>
          <div class="name"><span>姓　 名</span>
              <input type="text" name="account_name" id="account_name" value="" placeholder="请填写真实姓名" class="c-f-text">
          </div>
          <div class="name"><span>金　 额</span>
              <input type="text" name="money" id="money" placeholder="本次最多可提现{$remmoney}元"
                     class="c-f-text" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" onblur="this.value=this.value.replace(/[^\d.]/g,'')"/>
          </div>
          <div class="field submit-btn">
                 <input type="button" value="提交申请" class="btn_big1" onClick="checkSubmit();"/>
          </div>
          <input type="hidden" name="bank_name" id="bank_name" value="微信" class="c-f-text">
          <input type="hidden" name="account_bank" id="account_bank" value="{$user.dlopenid}" class="c-f-text">
      </form>
  </div>
 </div>
</div>
<div class="Wallet">   
	<div class="cash_num">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" id="ajax_return">
			<tr>
				<th>编号</th>
				<th>申请日期</th>                
				<th>金额</th>
				<th>状态</th>
			</tr> 
           <foreach name="list" item="v" > 
            <tr>
                <td>{$v['id']}</td>
                <td>{$v['create_time']|date="Y-m-d",###}</td>
                <td>{$v['money']}</td>
                <td>
                    <if condition="$v[status] eq 0">申请中</if>
                    <if condition="$v[status] eq 1">申请成功</if>
                    <if condition="$v[status] eq 2">申请失败</if>                   
                </td>
            </tr>
            </foreach>                                      
		</table>
	    <notempty name="list">
	          <p style="text-align: center;" id="getmore"><a href="javascript:void(0)" onClick="ajax_sourch_submit()">点击加载更多</a></p>  
        </notempty>            
	</div>
</div>


</div>
<include file="public/footer"/>
</div>
<include file="public/footer_nav"/>
</body>
<script src="__PUBLIC__/js/layer/layer.js"></script>
<script>
// 表单验证提交
function checkSubmit(){
	var money = $.trim($('#money').val());
	var bank_name = $.trim($('#bank_name').val());
	var account_bank = $.trim($('#account_bank').val());
	var account_name = $.trim($('#account_name').val());
	var verify_code = $.trim($('#verify_code').val());

	
	/*if(money > {$user['distribut_money']})
	{
		alert("你的收益余额为{$user['user_money']}，提现金额过大！");
		return false;
	}*/
			
	if(bank_name == '')
	{
		layer.msg('银行名称必填');
		return false;
	}
	if(account_bank == '')
	{
		layer.msg('收款账号必填');
		return false;
	}
	if(account_name == '')
	{
		var name=$('#account_name').parent().find('span').text().replace('　 ','');
		layer.msg(name+'必填');
		return false;
	}
	if(money == '')
	{
		layer.msg('提现金额必填');
		return false;
	}
	if(money < {$tpshop_config['basic_min']|default=100})
	{
		layer.msg("最少提现额度{$tpshop_config['basic_min']}");
		return false;
	}
	if(money > {$user['user_money']})
	{
		layer.msg('账户余额不足');
		return false;
	}
	
	$('#distribut_form').submit();
}

// 验证码切换
function verify(){
   $('#verify_code_img').attr('src','/index.php?m=Mobile&c=User&a=verify&type=withdrawals&r='+Math.random());
}

var  page = 1;
 /*** ajax 提交表单 查询订单列表结果*/  
 function ajax_sourch_submit()
 {	 	 	 
        page += 1;
		$.ajax({
			type : "GET",			
			url:"/index.php?m=Mobile&c=User&a=withdrawals&is_ajax=1&p="+page,//+tab,
//			data : $('#filter_form').serialize(),// 你的formid 搜索表单 序列化提交
			success: function(data)
			{
				if($.trim(data) == '')
					$('#getmore').hide();
				else{
				    $("#ajax_return").append(data);
				}
			}
		}); 
 } 

 function tabindex(num){
  $('.tab_hd li a').css({'border-bottom':0,'color':'inherit'})
  $('.tab_head'+num).css({'border-bottom':'2px solid #ec3913','color':'#ec3913'})
  $.ajax({
      type : "GET",
      url:"/index.php?m=Mobile&c=User&a=ajax_withdrawals&num="+num,//+tab,
      success: function(data)
      {
          $(".innercontent1").html(data);
      }
    }); 
}
</script>
</script>	
</html>